{% extends 'base.html' %}

{% block body %}
<!-- Get the updates.ini file to check for updates -->
{% if not ReleaseCheck.success %}
    {{ 'Error getting latest version information from server! Check the proxy setting.'|msg('ko') }}
{% endif %}

<!-- display current and latest version -->
{% if ReleaseCheck.success and ReleaseCheck.updateIsAvailable %}
    {% set style = 'color:red' %}
{% endif %}
<p>{{ 'Installed version:'|trans }} <span style='{{ style }}'>{{ constant('INSTALLED_VERSION', ReleaseCheck) }}</span>
{% if ReleaseCheck.success %}
    <!-- show a little green check if we have latest version -->
    {% if not ReleaseCheck.updateIsAvailable %}
        <i style='color:green' class='fas fa-check fa-lg align-top' title="Good job!"></i>
    {% endif %}
{% endif %}
<br>
{% if ReleaseCheck.success %}
    <!-- display latest version -->
    {{ 'Latest version:'|trans }} {{ ReleaseCheck.getLatestVersion }}</p>

    <!-- if we don't have the latest version, show button redirecting to doc -->
    {% if ReleaseCheck.updateIsAvailable %}
        {{ '%s - A new version is available! %sUpdate elabftw%sRead changelog%s'|trans|format(
            ReleaseCheck.getReleaseDate,
            "<a href='https://doc.elabftw.net/how-to-update.html' class='button btn btn-primary text-white'>",
            "</a><a href='" ~ ReleaseCheck.getChangelogLink ~ "' class='button btn btn-primary text-white'>",
            "</a>")|msg('warning') }}
    {% endif %}

    {% if App.Config.configArr.mail_from == 'notconfigured@example.com' %}
        {{ 'Please finalize install: %slink to documentation%s.'|trans|format("<a href='https://doc.elabftw.net/sysadmin-guide.html#setting-up-email'>", "</a>")|msg('ko') }}
    {% endif %}
{% endif %}

<p>Docker image version: {{ elabimgVersion }}<br />
MySQL database structure version: {{ App.Config.configArr.schema }}</p>

<ul id='menu'>
        <li class='tabhandle' id='tab1'>{{ 'Server'|trans }}</li>
        <li class='tabhandle' id='tab2'>{{ 'Teams'|trans }}</li>
        <li class='tabhandle' id='tab3'>{{ 'Users'|trans }}</li>
        <li class='tabhandle' id='tab4'>{{ 'Timestamp'|trans }}</li>
        <li class='tabhandle' id='tab5'>{{ 'Security'|trans }}</li>
        <li class='tabhandle' id='tab6'>{{ 'Email'|trans }}</li>
        <li class='tabhandle' id='tab7'>SAML</li>
        <li class='tabhandle' id='tab8'>{{ 'Privacy policy'|trans }}</li>
        <li class='tabhandle' id='tab9'>{{ 'External auth'|trans }}</li>
        <li class='tabhandle' id='tab10'>LDAP</li><span class='beta'>beta</span>
</ul>

<!-- TAB 1 SERVER -->
<div class='divhandle' id='tab1div'>
    <!-- STATS -->
    <div class='box'>
      <h3>{{ 'Usage Statistics'|trans }}</h3>
      <hr>
      <p>{{ 'Teams'|trans }}: {{ teamsStats.totteams }} - {{ 'Members'|trans }}: {{ teamsStats.totusers }} − {% trans %}Experiment{% plural teamStats.totxp %}Experiments{% endtrans %}: {{ teamsStats.totxp }} ({{ teamsStats.totxpts }} timestamped) − {{ 'Items'|trans }}: {{ teamsStats.totdb }}</p>
      <hr>
      <a href='make.php?what=report' class='button btn btn-primary'>{{ 'Generate report'|trans }}</a>
    </div>

    <div class='box'>
      <h3>{{ 'Announcement'|trans }}</h3>
      <hr>
      <p>{{ "The following text will be displayed to all users on all pages while it's active."|trans }}</p>
      <form method='post' action='app/controllers/SysconfigController.php'>
        <input class='form-control' type='text' name='announcement' value='{{ App.Config.configArr.announcement }}' />
        <div class='submitButtonDiv'>
          <button type='submit' class='button btn btn-primary'>{{ 'Save'|trans }}</button>
          <button type='submit' name='clear_announcement' class='button btn btn-danger'>{{ 'Clear'|trans }}</button>
        </div>
      </form>
    </div>

    <form class='box' method='post' action='app/controllers/SysconfigController.php'>
        <h3>{{ 'Settings'|trans }}</h3>
        <hr>
        <div class='form-group'>
          <input type='hidden' name='updateConfig' value='true' />
          <label for='lang'>{{ 'Language:'|trans }}</label>
          <select id='lang' name='lang' class='form-control col-md-4' autocomplete='off'>
              {% for lang, text in langsArr %}
              <option {{ App.Config.configArr.lang == lang ? ' selected' }} value='{{ lang }}'>{{ text }}</option>
              {% endfor %}
          </select>
          <p class='smallgray'>{{ 'The default language of this instance. It can be overriden by each users.' }}</p>

          <label for='proxy'>{{ 'Installation URL:'|trans }}</label>
          <input class='form-control col-md-4' type='url' value='{{ App.Config.configArr.url }}' name='url' id='url' />
          <p class='smallgray'>{{ 'The canonical address of the eLabFTW installation. If this value is empty, eLabFTW will try to guess it, but in some instances, it might not be correct so you should fill this setting. Example: https://elabftw.example.org'|trans }}</p>

          <label for='proxy'>{{ 'Address of the Proxy:'|trans }}</label>
          <input class='form-control col-md-4' type='text' value='{{ App.Config.configArr.proxy }}' name='proxy' id='proxy' />
          <p class='smallgray'>{{ 'If you are behind a firewall/proxy, enter the address here. Example: http://proxy.example.com:3128'|trans }}</p>

          <label for='deletable_xp'>{{ 'Admins can always delete experiments:'|trans }}</label>
          <select id='deletable_xp' name='deletable_xp' class='form-control col-md-4' autocomplete='off'>
              <option {{ App.Config.configArr.deletable_xp == 1 ? ' selected' }} value='1'>{{ 'Yes'|trans }}</option>
              <option {{ App.Config.configArr.deletable_xp == 0 ? ' selected' }} value='0'>{{ 'No'|trans }}</option>
          </select>
          <p class='smallgray'>{{ 'Setting this to «no» will completely remove the ability to delete experiments for everyone.'|trans }}</p>

          <label for='max_revisions'>{{ 'Maximum number of stored revisions per entry:'|trans }}</label>
          <input class='form-control col-md-4' type='number' min='0' max='999' value='{{ App.Config.configArr.max_revisions }}' name='max_revisions' id='max_revisions' />
          <p class='smallgray'>{{ 'Setting this to a low value will help keeping the database size small. Setting this to 0 will allow infinite number of revisions stored.'|trans }}</p>

          <h3>{{ 'Registration and authentication configuration'|trans }}</h3>

          <label for='anon_users'>{{ 'Allow anonymous visitors to login and see Public experiments:'|trans }}</label>
          <select class='form-control col-md-4' name='anon_users' id='anon_users'>
              <option value='1'{{ App.Config.configArr.anon_users ? " selected='selected'" }}>{{ 'Yes'|trans }}</option>
              <option value='0'{{ not App.Config.configArr.anon_users ? " selected='selected'" }}>{{ 'No'|trans }}</option>
          </select>
          <p class='smallgray'>{{ 'This allows users without an account to login into a team and see the experiments with public visibility. Administrators of each team can choose whether or not database items will be visible.'|trans }}</p>

          <label for='open_science'>{{ 'Switch this instance in open science mode:'|trans }}</label>
          <select id='open_science' name='open_science' class='form-control col-md-4'>
              <option {{ App.Config.configArr.open_science == '1' ? ' selected' }} value='1'>{{ 'Yes'|trans }}</option>
              <option {{ App.Config.configArr.open_science == '0' ? ' selected' }} value='0'>{{ 'No'|trans }}</option>
          </select>
          <p class='smallgray'>{{ 'This allows search engines to crawl the site. Visitors will be automatically logged in in the specified team.'|trans }}</p>

          <label for='open_team'>{{ 'Select which team will be open to the world in open science mode:'|trans }}</label>
          <select id='open_team' name='open_team' class='form-control col-md-4'>
              {% for team in teamsArr %}
              <option {{ App.Config.configArr.open_team == team.id ? ' selected' }} value='{{ team.id }}'>{{ team.name }}</option>
              {% endfor %}
          </select>
          <p class='smallgray'>{{ 'This has no effect if open science mode is disabled.'|trans }}</p>

          <label for='local_register'>{{ 'Enable local account creation:'|trans }}</label>
          <select id='local_register' name='local_register' class='form-control col-md-4'>
              <option {{ App.Config.configArr.local_register == '1' ? ' selected' }} value='1'>{{ 'Yes'|trans }}</option>
              <option {{ App.Config.configArr.local_register == '0' ? ' selected' }} value='0'>{{ 'No'|trans }}</option>
          </select>

          <label for='local_login'>{{ 'Show local login form:'|trans }}</label>
          <select id='local_login' name='local_login' class='form-control col-md-4'>
              <option {{ App.Config.configArr.local_login == '1' ? ' selected' }} value='1'>{{ 'Yes'|trans }}</option>
              <option {{ App.Config.configArr.local_login == '0' ? ' selected' }} value='0'>{{ 'No'|trans }}</option>
          </select>
          <p class='smallgray'>{{ 'You can still show the local login form by appending ?letmein to the login page URL.'|trans }}</p>

          <div class='submitButtonDiv'>
              <button type='submit' class='button btn btn-primary'>{{ 'Save'|trans }}</button>
          </div>
        </div>
    </form>

    <div class='box'>
      <h3>{{ 'Information'|trans }}</h3>
      <hr>
      <ul class='list-group'>
        <li class='list-group-item'>{{ 'Operating System'|trans }}: {{ phpInfos.0 }}</li>
        <li class='list-group-item'>{{ 'PHP Version'|trans }}: {{ phpInfos.1 }}</li>
        <li class='list-group-item'>{{ 'Largest integer supported'|trans }}: {{ phpInfos.2 }}</li>
        <li class='list-group-item'>{{ 'PHP configuration directory'|trans }}: {{ phpInfos.3 }}</li>
        <li class='list-group-item'>{{ 'Maximum file size for uploaded files'|trans }}: {{ phpInfos.4 }}</li>
        {% if phpInfos.5|length > 1 %}
          <li class='list-group-item'>{{ 'Timezone'|trans }}: {{ phpInfos.5 }}</li>
        {% endif %}
      </ul>
  </div>
</div>

<!-- TAB 2 TEAMS -->
<div class='divhandle' id='tab2div'>
    <div id='teamsDiv' class='form-group'>
        <!-- CREATE TEAM -->
        <div class='box'>
            <h3>{{ 'Add a New Team'|trans }}</h3>
            <hr>
            <input class='form-control custom-control-inline col-md-4' required type='text' placeholder='Pasteur lab' id='teamsName' />
            <button id='teamsCreateButton' class='button btn btn-primary'>{{ 'Save'|trans }}</button>
        </div>

        <!-- DISPLAY TEAMS -->
        <div class='box'>
          <h3>{{ 'Edit Existing Teams'|trans }}</h3>
          <hr>

          <ul class='list-group'>
            {% for team in teamsArr %}
              <li class='list-group-item'>
                <ul class='list-inline'>
                  <li class='list-inline-item mb-2'>
                    {% set count = Teams.getStats(team.id) %}
                    <label for='teamName_{{ team.id }}'>{{ 'Team Name'|trans }}</label>
                    <input data-id='{{ team.id }}' class='form-control custom-control-inline' id='teamName_{{ team.id }}' type='text' value='{{ team.name }}' />
                  </li>

                  <li class='list-inline-item mb-2'>
                    <label for='teamOrgid_{{ team.id }}'>{{ 'Team Organisation ID'|trans }}</label>
                    <input data-id='{{ team.id }}' class='form-control custom-control-inline' id='teamOrgid_{{ team.id }}' type='text' value='{{ team.orgid }}' />
                  </li>

                  <li class='list-inline-item mb-2'>
                    {% if count.totusers == 0 %}
                    <button data-id='{{ team.id }}' id='teamsDestroyButton_{{ team.id }}' class='button btn btn-danger teamsDestroyButton'>
                        {{ 'Delete'|trans }}
                    </button>
                    {% else %}
                    <button data-id='{{ team.id }}' id='teamsArchiveButton_{{ team.id }}' class='button btn btn-neutral teamsArchiveButton'>
                        {{ 'Archive'|trans }}
                    </button>
                  </li>

                  {% endif %}

                  <li class='list-inline-item mb-2'>
                    <label for='teamVisible_{{ team.id }}'>{{ 'Visible on registration page'|trans }}</label>
                    <select class='form-control' name='teamsVisible' id='teamVisible_{{ team.id }}'>
                      <option value='1'{{ team.visible ? " selected='selected'" }}>{{ 'Yes'|trans }}</option>
                      <option value='0'{{ not team.visible ? " selected='selected'" }}>{{ 'No'|trans }}</option>
                    </select>
                  </li>

                  <li class='list-inline-item mb-2'>
                    <button data-id='{{ team.id }}' id='teamsUpdateButton_{{ team.id }}' class='button btn btn-primary teamsUpdateButton'>
                        {{ 'Save'|trans }}
                    </button>
                  </li>

                  <li class='list-inline-item mb-2'>
                    <p class='smallgray'>{{ 'Members'|trans }}: {{ count.totusers }} −
                    {% trans %}
                    Experiment
                    {% plural count.totxp %}
                    Experiments
                    {% endtrans %}
                    : {{ count.totxp }} ({{ count.totxpts }} timestamped) − {{ 'Items'|trans }}: {{ count.totdb }} − {{ 'Created'|trans }}: {{ team.datetime }}<p>
                  </li>
                </ul>
              </li>
            {% endfor %}
        </ul>
      </div>
    </div>
</div>

<!-- TAB 3 USERS -->
<div class='divhandle' id='tab3div'>
    {% include('editusers.html') %}
</div>

<!-- TAB 4 TIMESTAMP -->
<div class='divhandle box' id='tab4div'>
    <form method='post' action='app/controllers/SysconfigController.php'>
      <div class='form-group'>
        <h3>{{ 'Timestamping Configuration'|trans }}</h3>
        <hr>
        <input type='hidden' name='updateConfig' value='true' />

        <label for='stampshare'>{{ 'The teams can use the credentials below to timestamp:'|trans }}</label>
        <select class='form-control col-md-4' name='stampshare' id='stampshare'>
          <option value='1' {{ App.Config.configArr.stampshare ? ' selected' }}>{{ 'Yes'|trans }}</option>
          <option value='0' {{ not App.Config.configArr.stampshare ? 'selected' }}>{{ 'No'|trans }}</option>
        </select>
        <p class='smallgray'>{{ 'You can control if the teams can use the global timestamping account. If set to <em>no</em> the team admin must add login information in the admin panel.'|trans|raw }}</p>

        <label for='stampprovider'>{{ 'URL for external timestamping service:'|trans }}</label>
        <input class='form-control col-md-4' type='url' placeholder='http://zeitstempel.dfn.de/' value='{{ App.Config.configArr.stampprovider }}' name='stampprovider' id='stampprovider' />
        <p class='smallgray'>{{ 'This should be the URL used for %sRFC 3161%s-compliant timestamping requests.'|trans|format("<a href='https://tools.ietf.org/html/rfc3161'>", "</a>")|raw }}</p>

        <label for='stampcert'>{{ 'Chain of certificates of the external timestamping service:'|trans }}</label>
        <input class='form-control col-md-4' type='text' placeholder='app/dfn-cert/pki.dfn.pem' value='{{ App.Config.configArr.stampcert }}' name='stampcert' id='stampcert' />
        <p class='smallgray'>{{ "This should point to the chain of certificates used by your external timestamping provider to sign the timestamps.%sLocal path relative to eLabFTW installation directory. You should add it in the 'uploads' folder. The file needs to be in %sPEM-encoded (ASCII)%s format!"|trans|format("<br>", "<a href='https://en.wikipedia.org/wiki/Privacy-enhanced_Electronic_Mail'>", "</a>")|raw }}</p>

        <label for='stamplogin'>{{ 'Login for external timestamping service:'|trans }}</label>
        <input class='form-control col-md-4' autocomplete='off' type='text' value='{{ App.Config.configArr.stamplogin }}' name='stamplogin' id='stamplogin' />
        <label for='stamppass'>{{ 'Password for external timestamping service:'|trans }}</label>
        {% if App.Config.configArr.stamppass|length > 1 %}
          <p>A password is already set.
          <a href='app/controllers/SysconfigController.php?clearStamppass=1'>Clear it</a> or change it below:</p>
        {% endif %}
        <input class='form-control col-md-4' autocomplete='off' type='password' name='stamppass' id='stamppass' />
        <div class='submitButtonDiv'>
          <button type='submit' class='button btn btn-primary'>{{ 'Save'|trans }}</button>
        </div>
      </div>
    </form>
</div>

<!-- TAB 5 SECURITY -->
<div class='divhandle box' id='tab5div'>
  <h3>{{ 'Security Settings'|trans }}</h3>
  <hr>
  <form class='form-group' method='post' action='app/controllers/SysconfigController.php'>
    <input type='hidden' name='updateConfig' value='true' />

    <label for='admin_validate'>{{ 'Users need validation by admin after registration:'|trans }}</label>
    <select class='form-control col-md-4' name='admin_validate' id='admin_validate'>
      <option value='1' {{ App.Config.configArr.admin_validate ? " selected" }}>{{ 'Yes'|trans }}</option>
      <option value='0' {{ not App.Config.configArr.admin_validate ? " selected" }}>{{ 'No'|trans }}</option>
    </select>
    <p class='smallgray'>{{ 'Set to yes for added security.'|trans }}</p>

    <label for='email_domain'>{{ 'Enforce a domain name for emails'|trans }}</label>
    <input id='email_domain' name='email_domain' class='form-control col-md-4' type='text' placeholder='example.edu' value='{{ App.Config.configArr.email_domain }}' />
    <p class='smallgray'>{{ 'Only email addresses at this domain will be allowed to register an account.'|trans }}<br>
    {{ 'You can add several domains by separating them with a comma.'|trans }}</p>

    <label for='login_tries'>{{ 'Number of allowed login attempts:'|trans }}</label>
    <input class='form-control col-md-4' type='number' value='{{ App.Config.configArr.login_tries }}' name='login_tries' id='login_tries' />
    <p class='smallgray'>{{ '3 might be too few. See for yourself :)'|trans }}</p>

    <label for='ban_time'>{{ 'Time of the ban after failed login attempts (in minutes):'|trans }}</label>
    <input class='form-control col-md-4' type='number' value='{{ App.Config.configArr.ban_time }}' name='ban_time' id='ban_time' />
    <p class='smallgray'>
      {{ 'To identify an user we use an md5 of user agent + IP. Because doing it only based on IP address would surely cause problems.'|trans }}
    </p>
    <div class='submitButtonDiv'>
      <button type='submit' class='button btn btn-primary'>{{ 'Save'|trans }}</button>
    </div>
  </form>
</div>

<!-- TAB 6 EMAIL -->
<div class='divhandle' id='tab6div'>
  <div class='box'>
    <h3>{{ 'E-mail Settings'|trans }}</h3>
    <hr>
    <form class='form-group' method='post' action='app/controllers/SysconfigController.php'>
      <input type='hidden' name='updateConfig' value='true' />
      <p>{{ "Without a valid way to send emails, users won't be able to reset their password. It is recommended to create a specific %ssmtp2go.com%s account and add the information here."|trans|format("<a href='https://www.smtp2go.com/?s=eLabFTW'>", "</a>")|raw }}</p>

      <label for='selectMailMethod'>{{ 'Send e-mails via:'|trans }}</label>
      <select class='form-control col-md-4' data-mailmethod='{{ App.Config.configArr.mail_method }}' name='mail_method' id='selectMailMethod'>
        <option value='' disabled>{{ 'Select mailing method...'|trans }}</option>
        <option value='smtp' {{ App.Config.configArr.mail_method == 'smtp' ? ' selected' }}>{{ 'SMTP (recommended)'|trans }}</option>
        <option value='sendmail' {{ App.Config.configArr.mail_method == 'sendmail' ? ' selected' }}>{{ 'Local MTA'|trans }}</option>
      </select>

      <div id='general_mail_config'>
        <label for='mail_from'>{{ 'Sender address:'|trans }}</label>
        <input class='form-control col-md-4' type='text' value='{{ App.Config.configArr.mail_from }}' name='mail_from' id='mail_from' />
      </div>

      <div id='sendmail_config'>
        <label for='sendmail_path'>{{ 'Path to sendmail:'|trans }}</label>
        <input class='form-control col-md-4' type='text' placeholder='/usr/bin/sendmail' value='{{ App.Config.configArr.sendmail_path }}' name='sendmail_path' id='sendmail_path' />
      </div>

      <div id='smtp_config'>
        <label for='smtp_address'>{{ 'Address of the SMTP server:'|trans }}</label>
        <input class='form-control col-md-4' type='text' value='{{ App.Config.configArr.smtp_address }}' placeholder='mail.smtp2go.com' name='smtp_address' id='smtp_address' />

        <label for='smtp_encryption'>{{ 'SMTP encryption:'|trans }}</label>
        <select class='form-control col-md-4' id='smtp_encryption' name='smtp_encryption'>
          <option value='ssl' {{ App.Config.configArr.smtp_encryption == 'ssl' ? ' selected' }}>TLS</option>
          <option value='tls' {{ App.Config.configArr.smtp_encryption == 'tls' ? ' selected' }}>STARTSSL</option>
          <option value='none' {{ App.Config.configArr.smtp_encryption == 'none' ? ' selected' }}>{{ 'None'|trans }}</option>
        </select>
        <span class='smallgray'>{{ 'Probably TLS'|trans }}</span>

        <label for='smtp_port'>{{ 'SMTP Port:'|trans }}</label>
        <input class='form-control col-md-4' type='text' placeholder='587' value='{{ App.Config.configArr.smtp_port }}' name='smtp_port' id='smtp_port' />
        <span class='smallgray'>{{ 'Default is 587.'|trans }}</span>

        <label for='smtp_username'>{{ 'SMTP username:'|trans }}</label>
        <input class='form-control col-md-4' type='text' value='{{ App.Config.configArr.smtp_username }}' name='smtp_username' id='smtp_username' />
        <label for='smtp_password'>{{ 'SMTP password'|trans }}</label>
        {% if App.Config.configArr.smtp_password|length == 0 %}
          <input class='form-control col-md-4' type='password' name='smtp_password' id='smtp_password' autocomplete='off' />
        {% else %}
          <p>
            {{ 'A password is already set.'|trans }}
            {{ '%sClear it%s or change it below:'|trans|format("
                <a href='app/controllers/SysconfigController.php?clearSmtppass=1'>",
                "</a>"
            )|raw }}
            <span class='button btn btn-primary mt-2 togglableNext'>{{ 'Edit'|trans }}</span>
            <input class='form-control col-md-4' type='password' name='smtp_password' style='display:none' autocomplete='off' id='hidden_smtp_password' />
          </p>
        {% endif %}
      </div>

      <div class='submitButtonDiv'>
        <button type='submit' class='button btn btn-primary'>{{ 'Save'|trans }}</button>
      </div>
    </form>
  </div>

  <!-- TEST EMAIL -->
  <div class='box form-group'>
    <label for='testemailEmail'>{{ 'Send a test email'|trans }}</label>
    <input class='form-control col-md-4' type='email' value='{{ App.Users.userData.email }}' id='testemailEmail' />
    <div class='submitButtonDiv'>
      <button id='testemailButton' class='button btn btn-primary'>{{ 'Send'|trans }}</button>
    </div>
  </div>

  <!-- MASS EMAIL -->
  <div class='box form-group'>
    <h3>{{ 'Send a Mass Email'|trans }}</h3>
    <hr>
    <label for='massSubject'>{{ 'Email Subject'|trans }}</label>
    <input class='form-control col-md-4' type='text' id='massSubject' size='45' />

    <label for='massBody'>{{ 'Email Body'|trans }}</label>
    <textarea class='form-control col-md-4' id='massBody'></textarea>
    <div class='submitButtonDiv'>
      <button id='massSend' class='button btn btn-primary'>{{ 'Send'|trans }}</button>
    </div>
  </div>

</div>

<!-- TAB 7 SAML -->
<div class='divhandle' id='tab7div'>
    {{ 'Note: the documentation about SAML is available %shere%s.'|format("<a href='https://doc.elabftw.net/saml.html'>", "</a>")|msg('ok', false) }}
    {{ 'Note: an XML file with the configuration is available %shere%s.'|format("<a href='metadata.php'>", "</a>")|msg('ok', false) }}
    <div class='box'>
        <form method='post' action='app/controllers/SysconfigController.php'>
            <h3>Service provider (this instance of eLabFTW)</h3>
            <div class='form-group'>
              <input type='hidden' name='updateConfig' value='true' />
              <label for='saml-toggle'>Toggle SAML login:</label>
              <select class='form-control col-md-4' id='saml-toggle' name='saml_toggle'>
                <option value='1'{{ App.Config.configArr.saml_toggle == '1' ? ' selected' }}>Enabled</option>
                <option value='0'{{ App.Config.configArr.saml_toggle == '0' ? ' selected' }}>Disabled</option>
              </select>

              <label for='saml-debug'>Debug mode:</label>
              <select class='form-control col-md-4' id='saml-debug' name='saml_debug'>
                <option value='1'{{ App.Config.configArr.saml_debug == '1' ? ' selected' }}>Yes</option>
                <option value='0'{{ App.Config.configArr.saml_debug == '0' ? ' selected' }}>No</option>
              </select>

              <label for='saml-strict'>Strict mode:</label>
              <select class='form-control col-md-4' id='saml-strict' name='saml_strict'>
                <option value='1'{{ App.Config.configArr.saml_strict == '1' ? ' selected' }}>Yes</option>
                <option value='0'{{ App.Config.configArr.saml_strict == '0' ? ' selected' }}>No</option>
              </select>

              <label for='saml-sync-teams'>Synchronize the local teams with the teams sent by IDP:</label>
              <select class='form-control col-md-4' id='saml-sync-teams' name='saml_sync_teams'>
                <option value='1'{{ App.Config.configArr.saml_sync_teams == '1' ? ' selected' }}>Enabled</option>
                <option value='0'{{ App.Config.configArr.saml_sync_teams == '0' ? ' selected' }}>Disabled</option>
              </select>

              <label for='saml-base'>Base url:</label>
              <input class='form-control col-md-4' type='url' id='saml-base' name='saml_baseurl' placeholder='https://elabftw.example.org' value='{{ App.Config.configArr.saml_baseurl }}' />

              <label for='saml-entityid'>EntityId:</label>
              <input class='form-control col-md-4' type='url' id='saml-entityid' name='saml_entityid' placeholder='https://elabftw.example.org' value='{{ App.Config.configArr.saml_entityid }}' />

              <label for='saml-acs-binding'>SAML protocol binding to be used when returning the Response message. Default is "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect".</label>
              <input class='form-control col-md-4' type='text' id='saml-acs-binding' name='saml_acs_binding' placeholder='urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect' value='{{ App.Config.configArr.saml_acs_binding}}' />

              <label for='saml-slo-binding'>Single Logout Service binding. Default is "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect".</label>
              <input class='form-control col-md-4' type='text' id='saml-slo-binding' name='saml_slo_binding' placeholder='urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect' value='{{ App.Config.configArr.saml_slo_binding }}' />

              <label for='saml-nameidformat'>NameIDFormat. Default is "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress".</label>
              <input class='form-control col-md-4' type='text' id='saml-nameidformat' name='saml_nameidformat' placeholder='urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress' value='{{ App.Config.configArr.saml_nameidformat }}' />

              <label for='x509'>x509 Certificate in PEM format</label>
              <textarea class='form-control col-md-4' id='x509' name='saml_x509'>{{ App.Config.configArr.saml_x509 }}</textarea>

              <label for='saml_privatekey'>x509 Certificate private key</label>
              <textarea class='form-control col-md-4' id='saml_privatekey' name='saml_privatekey'>{{ App.Config.configArr.saml_privatekey }}</textarea>

              <label for='saml-team'>What attribute to look for the team name:</label>
              <input class='form-control col-md-4' type='text' id='saml-team' name='saml_team' value='{{ App.Config.configArr.saml_team }}' />

              <label for='saml-team-create'>Create team sent by IDP if it doesn't exist already:</label>
              <select class='form-control col-md-4' id='saml-team-create' name='saml_team_create'>
                  <option value='1'{{ App.Config.configArr.saml_team_create == '1' ? ' selected' }}>Yes</option>
                  <option value='0'{{ App.Config.configArr.saml_team_create == '0' ? ' selected' }}>No</option>
              </select>

              <label for='saml-team-default'>If no team attribute is found, to which team user is assigned?</label>
              <select class='form-control col-md-4' name='saml_team_default' id='saml-team-default'>
                {% for team in teamsArr %}
                  <option {{ team.id == App.Config.configArr.saml_team_default ? 'selected' }} value='{{ team.id }}'>{{ team.name }}</option>
                {% endfor %}
                <option {{ 0 == App.Config.configArr.saml_team_default ? 'selected' }} value='0'>Throw error!</option>
              </select>

              <label for='saml-email'>What attribute to look for the email:</label>
              <input class='form-control col-md-4' type='text' id='saml-email' name='saml_email' value='{{ App.Config.configArr.saml_email }}' />

              <label for='saml-firstname'>What attribute to look for the firstname:</label>
              <input class='form-control col-md-4' type='text' id='saml-firstname' name='saml_firstname' value='{{ App.Config.configArr.saml_firstname }}' />

              <label for='saml-lastname'>What attribute to look for the lastname:</label>
              <input class='form-control col-md-4' type='text' id='saml-lastname' name='saml_lastname' value='{{ App.Config.configArr.saml_lastname }}' />

              <h4 class='mt-2'>Security settings</h4>
              <label for='saml-nameidencrypted'>Encrypt the nameID of the samlp:logoutRequest sent by this SP (nameIdEncrypted)</label>
              <select class='form-control col-md-4' id='saml-nameidencrypted' name='saml_nameidencrypted'>
                  <option value='1'{{ App.Config.configArr.saml_nameidencrypted == '1' ? ' selected' }}>Yes</option>
                  <option value='0'{{ App.Config.configArr.saml_nameidencrypted == '0' ? ' selected' }}>No</option>
              </select>

              <label for='saml-authnrequestssigned'>Sign the samlp:AuthnRequest messages sent (authnRequestsSigned)</label>
              <select class='form-control col-md-4' id='saml-authnrequestssigned' name='saml_authnrequestssigned'>
                  <option value='1'{{ App.Config.configArr.saml_authnrequestssigned == '1' ? ' selected' }}>Yes</option>
                  <option value='0'{{ App.Config.configArr.saml_authnrequestssigned == '0' ? ' selected' }}>No</option>
              </select>

              <label for='saml-logoutrequestsigned'>Sign the samlp:logoutRequest messages sent (logoutRequestSigned)</label>
              <select class='form-control col-md-4' id='saml-logoutrequestsigned' name='saml_logoutrequestsigned'>
                  <option value='1'{{ App.Config.configArr.saml_logoutrequestsigned == '1' ? ' selected' }}>Yes</option>
                  <option value='0'{{ App.Config.configArr.saml_logoutrequestsigned == '0' ? ' selected' }}>No</option>
              </select>

              <label for='saml-logoutresponsesigned'>Sign the samlp:logoutResponse messages sent (logoutresponsesigned)</label>
              <select class='form-control col-md-4' id='saml-logoutresponsesigned' name='saml_logoutresponsesigned'>
                  <option value='1'{{ App.Config.configArr.saml_logoutresponsesigned == '1' ? ' selected' }}>Yes</option>
                  <option value='0'{{ App.Config.configArr.saml_logoutresponsesigned == '0' ? ' selected' }}>No</option>
              </select>

              <label for='saml-signmetadata'>Sign the metadata (signMetadata)</label>
              <select class='form-control col-md-4' id='saml-signmetadata' name='saml_signmetadata'>
                  <option value='1'{{ App.Config.configArr.saml_signmetadata == '1' ? ' selected' }}>Yes</option>
                  <option value='0'{{ App.Config.configArr.saml_signmetadata == '0' ? ' selected' }}>No</option>
              </select>

              <label for='saml-wantmessagessigned'>Require the samlp:Response to be signed (wantMessagesSigned)</label>
              <select class='form-control col-md-4' id='saml-wantmessagessigned' name='saml_wantmessagessigned'>
                  <option value='1'{{ App.Config.configArr.saml_wantmessagessigned == '1' ? ' selected' }}>Yes</option>
                  <option value='0'{{ App.Config.configArr.saml_wantmessagessigned == '0' ? ' selected' }}>No</option>
              </select>

              <label for='saml-wantassertionsencrypted'>Require the saml:Assertion to be encrypted (wantAssertionsEncrypted)</label>
              <select class='form-control col-md-4' id='saml-wantassertionsencrypted' name='saml_wantassertionsencrypted'>
                  <option value='1'{{ App.Config.configArr.saml_wantassertionsencrypted == '1' ? ' selected' }}>Yes</option>
                  <option value='0'{{ App.Config.configArr.saml_wantassertionsencrypted == '0' ? ' selected' }}>No</option>
              </select>

              <label for='saml-wantassertionssigned'>Require the saml:Assertion to be signed (wantAssertionsSigned)</label>
              <select class='form-control col-md-4' id='saml-wantassertionssigned' name='saml_wantassertionssigned'>
                  <option value='1'{{ App.Config.configArr.saml_wantassertionssigned == '1' ? ' selected' }}>Yes</option>
                  <option value='0'{{ App.Config.configArr.saml_wantassertionssigned == '0' ? ' selected' }}>No</option>
              </select>

              <label for='saml-wantnameid'>Require the NameID element on the SAMLResponse received (wantNameId)</label>
              <select class='form-control col-md-4' id='saml-wantnameid' name='saml_wantnameid'>
                  <option value='1'{{ App.Config.configArr.saml_wantnameid == '1' ? ' selected' }}>Yes</option>
                  <option value='0'{{ App.Config.configArr.saml_wantnameid == '0' ? ' selected' }}>No</option>
              </select>

              <label for='saml-wantnameidencrypted'>Require the NameID element received to be encrypted (wantNameIdEncrypted)</label>
              <select class='form-control col-md-4' id='saml-wantnameidencrypted' name='saml_wantnameidencrypted'>
                  <option value='1'{{ App.Config.configArr.saml_wantnameidencrypted == '1' ? ' selected' }}>Yes</option>
                  <option value='0'{{ App.Config.configArr.saml_wantnameidencrypted == '0' ? ' selected' }}>No</option>
              </select>

              <label for='saml-wantxmlvalidation'>Validate all received xmls (strict mode must be activated) (wantXMLValidation)</label>
              <select class='form-control col-md-4' id='saml-wantxmlvalidation' name='saml_wantxmlvalidation'>
                  <option value='1'{{ App.Config.configArr.saml_wantxmlvalidation == '1' ? ' selected' }}>Yes</option>
                  <option value='0'{{ App.Config.configArr.saml_wantxmlvalidation == '0' ? ' selected' }}>No</option>
              </select>

              <label for='saml-relaxdestinationvalidation'>SAMLResponse with an empty value as its Destination will not be rejected for this fact. (relaxDestinationValidation)</label>
              <select class='form-control col-md-4' id='saml-relaxdestinationvalidation' name='saml_relaxdestinationvalidation'>
                  <option value='1'{{ App.Config.configArr.saml_relaxdestinationvalidation == '1' ? ' selected' }}>Yes</option>
                  <option value='0'{{ App.Config.configArr.saml_relaxdestinationvalidation == '0' ? ' selected' }}>No</option>
              </select>

              <label for='saml-lowercaseurlencoding'>ADFS compatibility on signature verification (lowercaseUrlEncoding)</label>
              <select class='form-control col-md-4' id='saml-lowercaseurlencoding' name='saml_lowercaseurlencoding'>
                  <option value='1'{{ App.Config.configArr.saml_lowercaseurlencoding == '1' ? ' selected' }}>Yes</option>
                  <option value='0'{{ App.Config.configArr.saml_lowercaseurlencoding == '0' ? ' selected' }}>No</option>
              </select>

              <div class='submitButtonDiv'>
                  <button type="submit" name="Submit" class='button btn btn-primary'>{{ 'Save'|trans }}</button>
              </div>

            </div>
        </form>
    </div>

    <div class='box'>
        <h3>Identity Providers Configuration</h3>

        <div class='box'>
            <h4>Add new Identity Provider</h4>
            <form method='post' action='app/controllers/IdpsController.php'>
              <div class='form-group'>
                <input type='hidden' name='idpsCreate' />

                <label for='name'>{{ 'Name'|trans }}</label>
                <input class='form-control col-md-4' type='text' id='name' name='name' required />

                <label for='entityid'>EntityId</label>
                <input class='form-control col-md-4' type='url' id='entityid' name='entityid' required />

                <label for='ssoUrl'>SSO URL</label>
                <input class='form-control col-md-4' type='url' id='ssoUrl' name='ssoUrl' required />

                <label for='ssoBinding'>SSO Binding</label>
                <input class='form-control col-md-4' type='text' id='ssoBinding' name='ssoBinding' required />

                <label for='sloUrl'>SLO URL</label>
                <input class='form-control col-md-4' type='url' id='sloUrl' name='sloUrl' />

                <label for='sloBinding'>SLO Binding</label>
                <input class='form-control col-md-4' type='text' id='sloBinding' name='sloBinding' />

                <label for='x509_idp'>x509 Certificate</label>
                <textarea class='form-control col-md-4' id='x509_idp' name='x509' required></textarea>

                <label for='active'>Active</label>
                <select class='form-control col-md-4' id='active' autocomplete='off' name='active'>
                    <option value='1' selected='selected'>{{ 'Yes'|trans }}</option>
                    <option value='0'>{{ 'No'|trans }}</option>
                </select>

                <div class='submitButtonDiv'>
                  <button type='submit' name='Submit' class='button btn btn-primary'>{{ 'Save'|trans }}</button>
                </div>
              </div>
            </form>
        </div>

        {% if idpsArr|length > 0 %}
            <h4>Existing Identity Providers</h4>
            {% for idp in idpsArr %}
                <div class='box' id='idps_div'>
                  <i class='fas fa-trash-alt fa-2x clickable idpsDestroy align_right' title='Delete' data-id='{{ idp.id }}'></i>
                  <h4>{{ idp.name|upper }} ({{ idp.entityid }})</h4>
                  <form method='post' action='app/controllers/IdpsController.php'>
                    <div class='form-group'>
                      <input type='hidden' name='idpsUpdate' />
                      <input type='hidden' name='id' value='{{ idp.id }}' />

                      <label for='editIdpName_{{ idp.id }}'>Name:</label>
                      <input class='form-control col-md-4' type='text' id='editIdpName_{{ idp.id }}' name='name' value='{{ idp.name }}' />
                      <label for='entityId_{{ idp.id }}'>entityId:</label>
                      <input class='form-control col-md-4' type='url' id='entityId_{{ idp.id }}' name='entityid' value='{{ idp.entityid }}' />
                      <label for='ssoUrl_{{ idp.id }}'>Single Sign-On URL:</label>
                      <input class='form-control col-md-4' type='url' id='ssoUrl_{{ idp.id }}' name='ssoUrl' value='{{ idp.sso_url }}' />
                      <label for='ssoBinding_{{ idp.id }}'>Single Sign-On binding. Default is "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST".</label>
                      <input class='form-control col-md-4' type='text' id='ssoBinding_{{ idp.id }}' name='ssoBinding' value='{{ idp.sso_binding }}' />
                      <label for='sloUrl_{{ idp.id }}'>Single Log Out URL:</label>
                      <input class='form-control col-md-4' type='url' id='sloUrl_{{ idp.id }}' name='sloUrl' value='{{ idp.slo_url }}' />
                      <label for='sloBinding_{{ idp.id }}'>Single Log Out binding. Default is "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect".</label>
                      <input class='form-control col-md-4' type='text' id='sloBinding_{{ idp.id }}' name='sloBinding' value='{{ idp.slo_binding }}' />
                      <label for='x509_{{ idp.id }}'>x509cert:</label>
                      <textarea class='form-control col-md-4' name='x509' id='x509_{{ idp.id }}'>{{ idp.x509 }}</textarea>
                      <label for='active_{{ idp.id }}'>Active</label>
                      <select class='form-control col-md-4 col-md-4' autocomplete='off' id='active_{{ idp.id }}' name='active'>
                          <option value='1' {{ idp.active ? " selected='selected'" }}>{{ 'Yes'|trans }}</option>
                          <option value='0' {{ not idp.active ? " selected='selected'" }}>{{ 'No'|trans }}</option>
                      </select>
                      <div class='submitButtonDiv'>
                          <button type='submit' name='Submit' class='button btn btn-primary'>{{ 'Save'|trans }}</button>
                      </div>
                    </div>
                  </form>
                </div>
            {% endfor %}
        {% endif %}

    </div>
</div>

<!-- TAB 8 PRIVACY POLICY -->
<div class='divhandle' id='tab8div'>
    <div class='box'>
        <h3>{{ 'Adjust your privacy policy notice'|trans }}</h3>
        <hr>
        {% if App.Config.configArr.privacy_policy is null %}
            {{ 'Note: the text below is a template and must be edited and saved.'|trans|msg('ok', false) }}
        {% endif %}

        <form method='post' action='app/controllers/SysconfigController.php'>
            {{ App.Csrf.getHiddenInput|raw }}
            <textarea name='privacy_policy' class='mceditable'>
                {{ App.Config.configArr.privacy_policy|default(privacyPolicyTemplate)|raw }}
            </textarea>
            <div class='submitButtonDiv'>
                <button type='submit' name='Submit' class='button btn btn-primary'>{{ 'Save'|trans }}</button>
                <button class='button btn btn-danger' type='submit' name='clear_policy'>{{ 'Clear'|trans }}</button>
            </div>
        </form>
    </div>
</div>

<!-- TAB 9 EXTERNAL AUTH -->
<div class='divhandle box' id='tab9div'>
    <form method='post' action='app/controllers/SysconfigController.php'>
      <div class='form-group'>
        <h3>{{ 'External authentication mapping'|trans }}</h3>
        <hr>
        <input type='hidden' name='updateConfig' value='true' />

          <p class='smallgray'>{{ 'If the server manages authentication, then you can provide here the environment variables names for user information.'|trans }}</p>

        <label for='extauth_remote_user'>{{ 'Remote user'|trans }}</label>
        <input class='form-control col-md-4' type='text' placeholder='REMOTE_USER' value='{{ App.Config.configArr.extauth_remote_user }}' name='extauth_remote_user' id='extauth_remote_user' />

        <label for='extauth_firstname'>{{ 'Firstname'|trans }}</label>
        <input class='form-control col-md-4' type='text' placeholder='MELLON_givenName' value='{{ App.Config.configArr.extauth_firstname }}' name='extauth_firstname' id='extauth_firstname' />

        <label for='extauth_lastname'>{{ 'Lastname'|trans }}</label>
        <input class='form-control col-md-4' type='text' placeholder='MELLON_sn' value='{{ App.Config.configArr.extauth_lastname }}' name='extauth_lastname' id='extauth_lastname' />

        <label for='extauth_email'>{{ 'Email'|trans }}</label>
        <input class='form-control col-md-4' type='text' placeholder='MELLON_mail' value='{{ App.Config.configArr.extauth_email }}' name='extauth_email' id='extauth_email' />

        <label for='extauth_teams'>{{ 'Teams'|trans }}</label>
        <input class='form-control col-md-4' type='text' placeholder='MELLON_ou' value='{{ App.Config.configArr.extauth_teams }}' name='extauth_teams' id='extauth_teams' />

        <label for='logout_url'>{{ 'Logout URL'|trans }}</label>
        <input class='form-control col-md-4' type='text' placeholder='https://idp.example.edu/saml/logout' value='{{ App.Config.configArr.logout_url }}' name='logout_url' id='logout_url' />

        <label for='extauth-team-default'>If no team attribute is found, to which team user is assigned?</label>
        <select class='form-control col-md-4' name='saml_team_default' id='extauth-team-default'>
          {% for team in teamsArr %}
            <option {{ team.id == App.Config.configArr.saml_team_default ? 'selected' }} value='{{ team.id }}'>{{ team.name }}</option>
          {% endfor %}
          <option {{ 0 == App.Config.configArr.saml_team_default ? 'selected' }} value='0'>Throw error!</option>
        </select>

        <label for='extauth-team-create'>Create team sent by server if it doesn't exist already:</label>
        <select class='form-control col-md-4' id='extauth-team-create' name='saml_team_create'>
            <option value='1'{{ App.Config.configArr.saml_team_create == '1' ? ' selected' }}>Yes</option>
            <option value='0'{{ App.Config.configArr.saml_team_create == '0' ? ' selected' }}>No</option>
        </select>


        <div class='submitButtonDiv'>
          <button type='submit' name='Submit' class='button btn btn-primary'>{{ 'Save'|trans }}</button>
        </div>
      </div>
    </form>
</div>

<!-- TAB 10 LDAP -->
<div class='divhandle box' id='tab10div'>
    <form method='post' action='app/controllers/SysconfigController.php'>
      <div class='form-group'>
        <h3>{{ 'LDAP configuration'|trans }}</h3>
        <hr>
        <input type='hidden' name='updateConfig' value='true' />

        <p class='smallgray'>{{ 'This page allows you to configure LDAP authentication.'|trans }}</p>

        <label for='ldap_toggle'>{{ 'Toggle LDAP login'|trans }}</label>
        <select class='form-control col-md-4' id='ldap_toggle' name='ldap_toggle'>
          <option value='1'{{ App.Config.configArr.ldap_toggle == '1' ? ' selected' }}>Enabled</option>
          <option value='0'{{ App.Config.configArr.ldap_toggle == '0' ? ' selected' }}>Disabled</option>
        </select>

        <label for='ldap_host'>{{ 'LDAP Host'|trans }}</label>
        <input class='form-control col-md-4' type='text' placeholder='ldap' value='{{ App.Config.configArr.ldap_host }}' name='ldap_host' id='ldap_host' />
        <p class='smallgray'>{{ 'Domain name or IP address'|trans }}</p>

        <label for='ldap_port'>{{ 'LDAP Port'|trans }}</label>
        <input class='form-control col-md-4' type='text' placeholder='389' value='{{ App.Config.configArr.ldap_port }}' name='ldap_port' id='ldap_port' />
        <p class='smallgray'>{{ 'Default: 389 LDAPS: 636'|trans }}</p>

        <label for='ldap_base_dn'>LDAP Base DN</label>
        <input class='form-control col-md-4' type='text' placeholder='dc=example,dc=com' value='{{ App.Config.configArr.ldap_base_dn }}' name='ldap_base_dn' id='ldap_base_dn' />

        <label for='ldap_username'>LDAP {{ 'Username'|trans }}</label>
        <input class='form-control col-md-4' type='text' placeholder='cn=admin,dc=example,dc=com' value='{{ App.Config.configArr.ldap_username}}' name='ldap_username' id='ldap_username' />

        <label for='ldap_password'>LDAP {{ 'Password'|trans }}</label>
        {% if App.Config.configArr.ldap_password|length == 0 %}
          <input class='form-control col-md-4' type='password' name='ldap_password' id='ldap_password' autocomplete='off' />
        {% else %}
          <p>
            {{ 'A password is already set.'|trans }}
            {{ '%sClear it%s or change it below:'|trans|format("
                <a href='app/controllers/SysconfigController.php?clearLdappass=1'>",
                "</a>"
            )|raw }}
            <span class='button btn btn-primary mt-2 togglableNext'>{{ 'Edit'|trans }}</span>
            <input class='form-control col-md-4' type='password' name='ldap_password' style='display:none' autocomplete='off' id='hidden_ldap_password' />
          </p>
        {% endif %}

        <label for='ldap-uid-cn'>Auth lookup with cn or uid?</label>
        <input class='form-control col-md-4' type='text' id='ldap-uid-cn' name='ldap_uid_cn' value='{{ App.Config.configArr.ldap_uid_cn }}' />

        <label for='ldap_use_tls'>{{ 'Use TLS'|trans }}</label>
        <select class='form-control col-md-4' id='ldap_use_tls' name='ldap_use_tls'>
          <option value='1'{{ App.Config.configArr.ldap_use_tls == '1' ? ' selected' }}>{{ 'Yes'|trans }}</option>
          <option value='0'{{ App.Config.configArr.ldap_use_tls == '0' ? ' selected' }}>{{ 'No'|trans }}</option>
        </select>

        <label for='ldap-team'>What attribute to look for the team name:</label>
        <input class='form-control col-md-4' type='text' id='ldap-team' name='ldap_team' value='{{ App.Config.configArr.ldap_team }}' />

        <label for='extauth-team-create'>Create team sent by server if it doesn't exist already:</label>
        <select class='form-control col-md-4' id='extauth-team-create' name='saml_team_create'>
            <option value='1'{{ App.Config.configArr.saml_team_create == '1' ? ' selected' }}>Yes</option>
            <option value='0'{{ App.Config.configArr.saml_team_create == '0' ? ' selected' }}>No</option>
        </select>

        <label for='extauth-team-default'>If no team attribute is found, to which team user is assigned?</label>
        <select class='form-control col-md-4' name='saml_team_default' id='extauth-team-default'>
          {% for team in teamsArr %}
            <option {{ team.id == App.Config.configArr.saml_team_default ? 'selected' }} value='{{ team.id }}'>{{ team.name }}</option>
          {% endfor %}
          <option {{ 0 == App.Config.configArr.saml_team_default ? 'selected' }} value='0'>Throw error!</option>
        </select>

        <label for='ldap-email'>What attribute to look for the email:</label>
        <input class='form-control col-md-4' type='text' id='ldap-email' placeholder='mail' name='ldap_email' value='{{ App.Config.configArr.ldap_email }}' />

        <label for='ldap-firstname'>What attribute to look for the firstname:</label>
        <input class='form-control col-md-4' type='text' id='ldap-firstname' placeholder='givenname' name='ldap_firstname' value='{{ App.Config.configArr.ldap_firstname }}' />

        <label for='ldap-lastname'>What attribute to look for the lastname:</label>
        <input class='form-control col-md-4' type='text' id='ldap-lastname' placeholder='sn' name='ldap_lastname' value='{{ App.Config.configArr.ldap_lastname }}' />

        <div class='submitButtonDiv'>
          <button type='submit' name='Submit' class='button btn btn-primary'>{{ 'Save'|trans }}</button>
        </div>
      </div>
    </form>
</div>
{% endblock body %}
